package com.zhxy.util.bean;

import java.util.ArrayList;
import java.util.List;

public class EventProvider<T> {
	
	private ArrayList<T> listeners = new ArrayList<T>();
	
	public synchronized void addEventListener(T listener) {
		listeners.add(listener);
	}
	
	public synchronized void removeEventListener(T listener) {
		listeners.remove(listener);
	}
	
	public synchronized List<T> toList() {
		return new ArrayList<T>(listeners);
	}
}
